package net.ssta.core.util.format;

import java.sql.SQLException;

import oracle.sql.BLOB;


public class OracleBlobFormat extends ValueObjectFormat
{
	
	public byte[] getBytes(Object value)
	{
		BLOB blob = (BLOB)value;
		try 
		{
			return value == null ? null : ((BLOB)value).getBytes(1,(int) blob.length());
		}
		catch (Exception e)
		{
			throw new RuntimeException(e);
		}
	}
	
	public String getString(Object value, String defaultValue)
	{
		byte[] data = getBytes(value);
		return data == null ? defaultValue : new String(data);
	}	
}
